
<script setup>

import { ref, watch, reactive } from "vue"
const count = ref(0)
const user = reactive({
  name: '张三',
  age: 6,
  info: {
    msg: '我是msg'
  }
})
// watch([count, user],() => {
//   console.log(user)
//   console.log('我变了')
// })
watch(() => user.info, () => {
  console.log('我变了')
}, {
  immediate: true,
  deep: true
})
setTimeout(() => {
  // count.value++
  user.info.msg = '你猜我打印么'
}, 3000)
</script>

<template>
  <div>
    <p>计数器: {{count}}</p>
    <p>年纪: {{user.age}}</p>
    <p>name: {{user.name}}</p>
    <p>msg: {{user.info.msg}}</p>
  </div>
</template>

